package com.zizo.autohome.potential.util;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;

import com.zizo.util.ConnectionPool;

public class PotentialUtil {
	private static final Connection conn = ConnectionPool.getConnection();

	public static final List<String> getUserIds() {
		List<String> list = new ArrayList<String>();
		Statement st = null;
		ResultSet rs = null;
		String sql = "select rz_uid,rz_cid from carvoice_potential.potential_user";
		try {
			st = conn.createStatement();
			rs = st.executeQuery(sql);
			while (rs.next()) {
				list.add(rs.getInt(1) + "-" + rs.getInt(2));
			}
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return list;
	}

	public static final List<Integer> getCarIds() {
		List<Integer> list = new ArrayList<>();
		Statement st = null;
		ResultSet rs = null;
		String sql = "SELECT DISTINCT autohome_autohomeClubId FROM carvoice_core.core_brand_autohome";
		try {
			st = conn.createStatement();
			rs = st.executeQuery(sql);
			while (rs.next()) {
				list.add(rs.getInt(1));
			}
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return list;
	}
}
